package com.dong.es.config;

import co.elastic.clients.elasticsearch.ElasticsearchClient;

import java.util.function.Function;

/**
 * @description: 封装ES客户端的实体类
 * @author: 陈瑞东
 * @create: 2022-04-20 08:44
 */
public class EsClient {
    private ElasticsearchClient client;
    private Function close = f -> f;

    public void close() {
        if (close != null) {
            close.apply("");
        }
    }

    public ElasticsearchClient getClient() {
        return client;
    }

    public void setClient(ElasticsearchClient client) {
        this.client = client;
    }

    public Function getClose() {
        return close;
    }

    public void setClose(Function close) {
        this.close = close;
    }
}
